import React from "react";
import styles from "./index.module.scss";

/**
 * 答案选项卡
 * 
 * @param choices {[string]} 选项数组
 * @param setCurChoice {function} 设置当前选的答案
 * @param setHint {function} 去除错误提示
 * @return {JSX.Element} 答案选项卡
 */
const Index = ({ choices, setCurChoice, setHint }) => {
  return (
    <div className={styles.btnsWrapper}>
      {choices.map((elm, i) => {
        return (
          <div className={styles.btnWrapper}>
            <div
              className={styles.btn}
              onClick={() => {
                setCurChoice((p) => elm);
                setHint((h) => "");
              }}
            >
              {elm}
            </div>
          </div>
        );
      })}
    </div>
  );
};

export default Index;
